]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
timeLimitsManager: Don't log transitions from history
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 27 May 2025 15:48:15 +0000 (17:48 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 5 Jun 2025 13:45:10 +0000 (15:45 +0200)
The history file can get quite large, with the result that we
flood the journal with pages and pages of old transition if
debug messages are enabled.

Instead, suppress the regular debug log and print a summary message
at the end instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3740>

js/misc/timeLimitsManager.js

index dd189e2853c13ff2af09584db689145cead3bd6c..dd2ddc311ad27b456cd462692ffa7bbe04d5a832 100644 (file)
@@ -456,7 +456,7 @@ export const TimeLimitsManager = GObject.registerClass({
     }
 
     _addTransition(oldState, newState, wallTimeSecs,
-        {recalculateState = true} = {}) {
+        {recalculateState = true, debugLog = true} = {}) {
         this._stateTransitions.push({
             oldState,
             newState,
@@ -465,8 +465,10 @@ export const TimeLimitsManager = GObject.registerClass({
 
         this._userState = newState;
 
-        console.debug('TimeLimitsManager: User state changed from ' +
-            `${userStateToString(oldState)} to ${userStateToString(newState)} at ${wallTimeSecs}s`);
+        if (debugLog) {
+            console.debug('TimeLimitsManager: User state changed from ' +
+                `${userStateToString(oldState)} to ${userStateToString(newState)} at ${wallTimeSecs}s`);
+        }
 
         // This potentially changed the limit time and timeout calculations.
         if (recalculateState && this._state !== TimeLimitsState.DISABLED) {
@@ -545,10 +547,13 @@ export const TimeLimitsManager = GObject.registerClass({
                 entry['newState'],
                 entry['wallTimeSecs'], {
                     recalculateState: i === history.length - 1,
+                    debugLog: false,
                 });
             previousWallTimeSecs = entry['wallTimeSecs'];
         }
 
+        console.debug(`TimeLimitsManager: Loaded ${history.length} transitions from history`);
+
         this.thaw_notify();
     }